using System;
using System.Collections.Generic;
using System.Text;

using System.Xml.Serialization;
using System.IO;
using System.Xml;
using System.Xml.Schema;

using System.Globalization;
using Barbar.MapReport.Common;
using Barbar.MapReport.Common.Drawing;

namespace Barbar.MapReport.HtmlRender.Operations.ValueIndicators {
  [Serializable]
  internal class FlatPoint : IGeoPoint {
    private decimal m_Latitude;
    private decimal m_Longitude;
    private decimal[] m_Values = new decimal[2];
    private PointD m_ProjectedPoint;
    private string m_ToolTip;
    private string m_ToolTipAggregation;

    public FlatPoint() {
    }

    public FlatPoint(BusinessGeoPoint point) {
      m_Latitude = point.Latitude;
      m_Longitude = point.Longitude;
      m_Values[0] = point.Value1;
      m_Values[1] = point.Value2;
      m_ToolTip = point.ToolTip;
      m_ToolTipAggregation = point.ToolTipForAggregation;
    }

    public decimal this[int index] {
      get {
        if (index < 0 || index > m_Values.Length)
          throw new ArgumentOutOfRangeException("index");
        return m_Values[index];
      }
    }

    public decimal Value1 {
      get { return m_Values[0]; }
      set { m_Values[0] = value; }
    }

    public decimal Value2 {
      get { return m_Values[1]; }
      set { m_Values[1] = value; }
    }

    public string ToolTip {
      get { return m_ToolTip; }
      set { m_ToolTip = value; }
    }

    public string ToolTipForAggregation {
      get { return m_ToolTipAggregation; }
      set { m_ToolTipAggregation = value; }
    }

    #region IGeoPoint Members

    [XmlAttribute("g")]
    public decimal Longitude {
      get { return m_Longitude; }
      set { m_Longitude = value; }
    }

    [XmlAttribute("t")]
    public decimal Latitude {
      get { return m_Latitude; }
      set { m_Latitude = value; }
    }

    #endregion

    internal PointD ProjectedPoint {
      get { return m_ProjectedPoint; }
      set { m_ProjectedPoint = value; }
    }
  }  
}
